<%-- 
    Document   : function
    Created on : 2014-12-14, 20:05:10
    Author     : michal
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>

<jsp:include page="/header.jsp" />

<html:errors></html:errors>

<html:form action="fuzzy.do?method=manage" styleId="manage-function-form">
    <div>
        <label for="value">Value:</label>
        <html:text property="wartosc" styleId="value" />
        <html:submit value="Save" />
    </div>
    
    <% if (request.getParameter("functionId") != null) { %>
        <html:hidden property="funNr" styleId="functionId" />
    <% } %>
    <html:hidden property="isSent" value="true" />
</html:form>

<div id="chart_div" style="width: 400px; height: 200px;"></div>
    <script type="text/javascript">
      google.load("visualization", "1", {packages:["corechart"]});
      google.setOnLoadCallback(drawChart);
      function drawChart() {
        var data = google.visualization.arrayToDataTable([
          ['Koszt', 'Value'],
          [<%= request.getAttribute("valueA") %>,  0],
          [<%= request.getAttribute("valueB") %>,  1],
          [<%= request.getAttribute("valueC") %>,  0]
        ]);

        var options = {
            backgroundColor: {
                stroke: '#eee',
                fill: 'transparent'
            },
            colors: ['orange'],
            chartArea: {top: 50, width: '100%', left: 50},
            hAxis: {gridlines: {color: '#777'}, textStyle: {color: '#eee'}},
            vAxis: {minValue: 0, gridlines: {color: '#777'}, textStyle: {color: '#eee'}}
        };

        var chart = new google.visualization.AreaChart(document.getElementById('chart_div'));
        chart.draw(data, options);
      }
    </script>

<jsp:include page="/footer.jsp" />